//
// Created by blackplume on 17-10-19.
//

#include "Command.h"
#include "Buildin_Command.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <readline/readline.h>
#include <zconf.h>

int cd_command( char**parameters,char *&out){
    //printf(parameters[1]);
    if(strcmp(parameters[1],"..")==0){
        char* path=get_current_dir_name();
        *(strrchr(path,'/'))='\0';
        chdir(path);
    } else{
        chdir(parameters[1]);
    }
}

int quit_comand(char**parameters,char *&out){
    exit(getppid());
}
int about_comand(char**parameters,char *&out)
{
    const char* Command_Version="0.1.0";
    printf("This is my shell. \nmake by blackplume   \n@Bata%s\n",Command_Version);
}
int testIn_command(char**parameters,char *&out){

    char * test=(char*)malloc(sizeof(char)*100);
    test=readline("请输入");
    printf("%s\n",test);
//    while(read(STDIN_FILENO,test,99)!=0){
//        printf("%s\n",test);
//    }
}


